import { observable } from 'mobx';
import { GetUserList } from '@src/service/userApi';

const OneStore = observable({
    userList: [],

    loadUserList() {
        //异步获取数据
        this.userList = [{
            key: '1',
            firstName: 'John',
            lastName: 'Brown',
            age: 32,
            address: 'New York No. 1 Lake Park',
            tags: ['nice', 'developer'],
        },
        {
            key: '2',
            firstName: 'Jim',
            lastName: 'Green',
            age: 42,
            address: 'London No. 1 Lake Park',
            tags: ['loser'],
        },
        {
            key: '3',
            firstName: 'Joe',
            lastName: 'Black',
            age: 32,
            address: 'Sidney No. 1 Lake Park',
            tags: ['cool', 'teacher'],
        }];
    },

    async loadUserListAsync() {
        var resultData = await GetUserList();
        this.userList = resultData.list;
        console.log(this.userList, "==========this.userList==========");
    }
})

export default OneStore;